package com.itheima.web.service.impl.sms;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.service.sms.AdvertiseService;
import com.itheima.vo.sms.Advertise;
import com.itheima.web.mapper.sms.AdvertiseMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.logging.log4j.util.Strings;
import org.springframework.stereotype.Service;

@DubboService
public class AdvertiseServiceImpl extends ServiceImpl<AdvertiseMapper, Advertise> implements AdvertiseService {

    @Override
    public Page<Advertise> getPage(String endTime, String name, Integer pageNum, Integer pageSize, Integer type) {
        Page<Advertise> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<Advertise> alqw=new LambdaQueryWrapper<>();
        alqw.like(Strings.isNotEmpty(endTime),Advertise::getEndTime,endTime);
        alqw.like(Strings.isNotEmpty(name),Advertise::getName,name);
        alqw.eq(type!=null,Advertise::getType,type);
        this.page(page,alqw);
        return page;
    }
}
